import 'package:flutter/material.dart';
import '../../model/danger2.dart';
import '../../model/doc_review.dart';
import '../../model/inspectreport.dart';
import '../../pages/danger2/danger_info.dart';
import '../../pages/danger2/danger_info.dart';
import '../../pages/inspectreport/inspectReport_info.dart';
import '../../model/cleanobjects.dart';
import '../../model/docsend.dart';
import '../../model/skddl2.dart';

import '../helper/channelHelper.dart';
import '../model/shipuse.dart';
import '../pages/shipuse/shipuse_authorty.dart';
import '../model/danger.dart';

import '../helper/uidata.dart';
import '../model/stationcheck.dart';
import '../pages/station/stationcheck_list.dart';

import '../model/jxgzp.dart';
import '../model/skddl.dart';

import '../helper/cacheHelper.dart';

import '../spaces/report_space/report_list.dart';

import '../helper/Helper.dart';

import '../helper/global_config.dart';

import '../helper/routeHelper.dart';

import '../model/report.dart';
import '../model/station.dart';
import '../model/user.dart';
import 'IconWidget.dart';

import 'dialogWidget.dart';

class SomeCard {
  static Widget StationCard(BuildContext context, Station station) {
    return Card(
        key: Key(station.Guid),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        color: GlobalConfig.cardBackgroundColor,
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: ListTile(
          //leading: ImageWidget.StationImage(StationList[index].Name),
          title: Text(station.STNM),
          //trailing: Text(StationList[index].STCD),

          onTap: () {
            RouteHelper.StationInfoPage(context, station);
          },
        ));
  }

  static Widget DangerCard2(BuildContext context, Danger danger) {
    return Card(
        key: Key(danger.Guid),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        color: GlobalConfig.cardBackgroundColor,
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: ListTile(
          leading: danger.State == 2
              ? IconWidget.DangerImage()
              : IconWidget.DangerImage2(),
          title: Text(danger.Title),
          trailing: Text(CacheHelper.GetUser(danger.CreateUser).Name),
          // subtitle: Text(Helper.DateTimeFormat(danger.CreateTime)),
          onTap: () {
            RouteHelper.DangerInfoPage(context, danger);
          },
        ));
  }

  static Widget Danger2Card(
      BuildContext context, Danger2 s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat2(s1.CreateTM);
    //bz =bz+"     "+  s1.Level;
    if (s1.State == 0) bz = bz + "     待审核";
    if (s1.State == 1) bz = bz + "     整改中";
    if (s1.State == 2) bz = bz + "     已完成";

    return Card(
      key: Key(s1.Guid),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      color: GlobalConfig.cardBackgroundColor,
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
          leading: s1.State == 2
              ? IconWidget.DangerImage()
              : IconWidget.DangerImage2(),
          title: Text(s1.Title),
          trailing: Text(CacheHelper.GetUser(s1.CreateUser).Name),
          subtitle: Text(bz),
          onTap: () {
            RouteHelper.Danger2InfoPage(context, s1);
          },
          onLongPress: () {
            if (s1.State > 0) {
              ChannelHelper.showToast("已审核，不可删除！");
              return;
            }

            if (Helper.UserPB(s1.CreateUser)) {
              ChannelHelper.showToast("只能删除本人创建！");
              return;
            }

            showDialog(
              context: context,
              builder: (BuildContext context) {
                return DialogWidget.getDialog(context, "删除申请",
                    "点击确定键将删除该条隐患登记！     编号：" + s1.ID.toString(), () {
                  Danger2.Delete(s1);
                  callback();
                });
              },
            );
          }),
    );
  }

  static Widget DangerCard(
      BuildContext context, Danger s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat2(s1.CreateTM);
    //bz =bz+"     "+  s1.Level;
    if (s1.State == 0) bz = bz + "     待处置";
    if (s1.State == 1) bz = bz + "     待审核";
    if (s1.State == 2) bz = bz + "     已完成";

    return Card(
      key: Key(s1.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
          leading: s1.State == 2
              ? IconWidget.ProblemImage()
              : IconWidget.ProblemImage2(),
          title: Text(s1.Title),
          subtitle: Text(
            bz,
            style:
                TextStyle(color: Colors.black38, fontSize: 14.0, height: 1.8),
          ),
          trailing: Text(CacheHelper.GetUser(s1.CreateUser).Name),
          onTap: () {
            RouteHelper.DangerInfoPage(context, s1);
          },
          onLongPress: () {
            if (s1.State > 0) {
              ChannelHelper.showToast("处置完成，不可删除！");
              return;
            }

            if (Helper.UserPB(s1.CreateUser)) {
              ChannelHelper.showToast("只能删除本人创建！");
              return;
            }

            showDialog(
              context: context,
              builder: (BuildContext context) {
                return DialogWidget.getDialog(
                    context, "删除申请", "点击确定键将删除该条问题！     编号：" + s1.ID.toString(),
                    () {
                  Danger.Delete(s1);
                  callback();
                });
              },
            );
          }),
    );
  }

  static Widget XHSSZTCard(BuildContext context, Station station) {
    return Card(
        key: Key(station.Guid),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        color: GlobalConfig.cardBackgroundColor,
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: ListTile(
          //leading: ImageWidget.StationImage(StationList[index].Name),
          title: Text(station.STNM),
          //trailing: Text(StationList[index].STCD),

          onTap: () {
            RouteHelper.StationInfoPage(context, station);
          },
        ));
  }

  static Widget StationCard2(BuildContext context, Station station) {
    return
        // padding: const EdgeInsets.only(left: 5.0, right: 5.0),
        ListTile(
      // leading: Icon(FontAwesomeIcons.rainbow),

      title: Text(station.STNM),
      leading: Icon(
        Icons.location_on,
        color: Colors.black38,
      ),
      trailing: Text(
        station.STTP,
        style: TextStyle(color: Colors.black38),
      ),

      onTap: () {
        RouteHelper.StationInfoPage(context, station);
      },
    );
    ;
  }

  static Widget ReportCard(BuildContext context, Report record) {
    var t1 = DateTime.parse(record.CreateTime);
    //var u1 = CacheHelper.GetUser(record.UserId);
    return new Card(
      key: Key(record.Guid),
      margin: const EdgeInsets.only(top: 5.0, bottom: 5.0),
      // margin: const EdgeInsets.all(6.0),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      color: GlobalConfig.cardBackgroundColor,
      child: new Container(
          // margin: EdgeInsets.all(4.0),
          // padding: EdgeInsets.all(4.0),
          child: ListTile(
        onLongPress: () {
          showDialog(
            context: context,
            builder: (BuildContext context) {
              return DialogWidget.getDialog(
                  context, "删除记录", "点击确定键将删除该条记录！     " + record.Content, () {
                Report.Delete(record);
              });
            },
          );
        },
        title: Text(record.Content),
        subtitle: Text(
          Helper.DateTimeFormat(record.CreateTime),
          style: TextStyle(color: Colors.black38, height: 1.5),
        ),
      )),
    );
  }

  static Widget ReportCard3(
      BuildContext context, Report record, ReportDeleteCallback refrush) {
    var t1 = DateTime.parse(record.CreateTime);
    var u1 = CacheHelper.GetUser(record.UserId);
    String _remark = Helper.DateTimeFormat(record.CreateTime);
    if (u1 != null) _remark = _remark + "     " + u1.Name;
    return new Card(
      key: Key(record.Guid),
      margin: const EdgeInsets.only(top: 5.0, bottom: 5.0),
      // margin: const EdgeInsets.all(6.0),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      color: GlobalConfig.cardBackgroundColor,
      child: new Container(
          // margin: EdgeInsets.all(4.0),
          // padding: EdgeInsets.all(4.0),
          child: ListTile(
        onLongPress: () {
          showDialog(
            context: context,
            builder: (BuildContext context) {
              if (u1 != null && u1.Guid != record.UserId) {
                return DialogWidget.getAlert(context, "提示", "只能删除自己上传的记录");
              } else {
                return DialogWidget.getDialog(
                    context, "删除记录", "点击确定键将删除该条记录！     " + record.Content, () {
                  Report.Delete(record);
                  refrush(record);
                });
              }
            },
          );
        },
        title: Text(record.Content),
        subtitle: Text(
          _remark,
          style: TextStyle(color: Colors.black38, height: 1.5),
        ),
      )),
    );
  }

  static Widget ReportCard2(BuildContext context, Report record) {
    var t1 = DateTime.parse(record.CreateTime);
    //var u1 = CacheHelper.GetUser(record.UserId);
    return new Card(
        key: Key(record.Guid),
        // margin: const EdgeInsets.only(top: 5.0, bottom: 5.0),
        margin: const EdgeInsets.all(6.0),
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        color: GlobalConfig.cardBackgroundColor,
        child: new Container(
          margin: EdgeInsets.all(4.0),
          padding: EdgeInsets.all(4.0),
          child: new Column(
            children: <Widget>[
              //    cardUser(context, u1, "汇报者： "),
              //   (u1 == null) ? new Container() : Divider(height: 0.0),
              record.Title != ""
                  ? cardRemark2("" + record.Title)
                  : new Container(),
              Divider(height: 0.0),
              cardRemark2("" + record.Content),
              Divider(height: 0.0),
              cardTime2(record.CreateTime),
            ],
          ),
        ));
  }

  static Widget cardRemark2(String r1) {
    return new Container(
        child: r1 == null
            ? null
            : new Text(r1,
                style: new TextStyle(
                    height: 1.3,
                    color: GlobalConfig.fontColor,
                    fontSize: 16.0)),
        margin: const EdgeInsets.all(6.0),
        padding: const EdgeInsets.only(top: 6.0, bottom: 6.0),
        alignment: Alignment.topLeft);
  }

  static Widget cardTime2(String s1) {
    var t1 = DateTime.parse(s1);
    return new Container(
        child: new Text(t1 != null ? Helper.DateTimeToString(t1) : "",
            style: new TextStyle(
                height: 1.3, color: Colors.black38, fontSize: 16.0)),
        margin: const EdgeInsets.all(6.0),
        padding: const EdgeInsets.only(top: 6.0, bottom: 6.0),
        alignment: Alignment.topLeft);
  }

  static Widget cardUser(BuildContext context, User u1, String title) {
    if (u1 == null) return new Container();
    return new GestureDetector(
        onTap: () {
          // RouteHelper.UserInfo(context, u1);
        },
        child: Container(
            child: new Text(title + u1.Name,
                style: new TextStyle(
                    height: 1.3,
                    color: GlobalConfig.fontColor,
                    fontSize: 16.0)),
            margin: const EdgeInsets.all(6.0),
            width: double.infinity,
            padding: const EdgeInsets.only(top: 6.0, bottom: 6.0),
            alignment: Alignment.topLeft));
  }

  static Widget IfEndIcon(bool pb1) {
    return Container(
        width: 10.0,
        height: 10.0,
        child: CircleAvatar(
          backgroundColor: pb1 ? Colors.green : Colors.red,
          //radius: 2.0,
        ));
  }

  static Widget SKDDLCard(
      BuildContext context, SKDDL s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat(s1.CreateTime);
    if (s1.State == 0) bz = bz + "     部门批复中";
    if (s1.State == 1) bz = bz + "     会签中";
    if (s1.State == 2) bz = bz + "     公司领导批复中";
    if (s1.State == 3) bz = bz + "     已签发，发布中";
    if (s1.State == 4) bz = bz + "     已发布，待执行";
    if (s1.State == 5) bz = bz + "     回执审核中";
    if (s1.State == 6) bz = bz + "     完成";

    return Card(
      key: Key(s1.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
        //leading: ImageWidget.UpFileImage(s1.Name),
        title: Text(s1.Title),
        subtitle: Text(
          bz,
          style: TextStyle(color: Colors.black38, fontSize: 14.0, height: 1.8),
        ),
        trailing: Container(
          width: 10.0,
          height: 10.0,
          child: new CircleAvatar(
            backgroundColor: s1.State == 6 ? Colors.green : Colors.red,
            //radius: 2.0,
          ),
        ),
        //trailing: Text("马龙伟"),
        // leading: IconHelper.getFileIcon(s1., 36.0),
        onTap: () {
          RouteHelper.getSKDDLInfoPage(context, s1, callback);
        },
      ),
    );
  }

  static Widget SKDDL2Card(
      BuildContext context, SKDDL2 s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat(s1.CreateTime);
    if (s1.State == 0) bz = bz + "     部门批复中";
    if (s1.State == 1) bz = bz + "     会签中";
    if (s1.State == 2) bz = bz + "     公司领导审核中";
    if (s1.State == 3) bz = bz + "     公司领导签发中";
    if (s1.State == 4) bz = bz + "     已签发，发布中";
    if (s1.State == 5) bz = bz + "     已发布，待执行";
    if (s1.State == 6) bz = bz + "     回执审核中";
    if (s1.State == 7) bz = bz + "     完成";

    return Card(
      key: Key(s1.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
        //leading: ImageWidget.UpFileImage(s1.Name),
        title: Text(s1.Title),
        subtitle: Text(
          bz,
          style: TextStyle(color: Colors.black38, fontSize: 14.0, height: 1.8),
        ),
        trailing: Container(
          width: 10.0,
          height: 10.0,
          child: new CircleAvatar(
            backgroundColor: s1.State == 7 ? Colors.green : Colors.red,
            //radius: 2.0,
          ),
        ),
        //trailing: Text("马龙伟"),
        // leading: IconHelper.getFileIcon(s1., 36.0),
        onTap: () {
          RouteHelper.getSKDDL2InfoPage(context, s1, callback);
        },
      ),
    );
  }

  static Widget ShipUseCard(
      BuildContext context, ShipUse s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat2(s1.CreateTime);
    if (s1.State == 0) bz = bz + "     部门负责人确认中";
    if (s1.State == 1) bz = bz + "     船艇管理人员确认中";
    if (s1.State == 2) bz = bz + "     实业公司确认中";
    if (s1.State == 3) bz = bz + "     河道部确认中";
    if (s1.State == 4) bz = bz + "     公司领导批复中";
    if (s1.State == 5) bz = bz + "     已批复";
    if (s1.State == 6) bz = bz + "     完成";

    return Card(
        key: Key(s1.ID.toString()),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: Container(
          margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
          child: ListTile(

              //leading: ImageWidget.UpFileImage(s1.Name),
              title: Text(s1.Department),
              subtitle: Text(
                bz,
                style: TextStyle(
                    color: Colors.black38, fontSize: 14.0, height: 1.8),
              ),
              trailing: Container(
                width: 10.0,
                height: 10.0,
                child: new CircleAvatar(
                  backgroundColor: s1.State == 6 ? Colors.green : Colors.red,
                  //radius: 2.0,
                ),
              ),
              //trailing: Text("马龙伟"),
              // leading: IconHelper.getFileIcon(s1., 36.0),
              onTap: () {
                RouteHelper.getShipUseInfoPage(context, s1, callback);
              },
              onLongPress: () {
                if (s1.State > 2) {
                  ChannelHelper.showToast("部门审核完成，不可删除！");
                  return;
                }

                if (!ShipUseAuthority.IfHuiZhi(UIData.CurrentUser!)) {
                  ChannelHelper.showToast("删除需管理员权限！");
                  return;
                }

                showDialog(
                  context: context,
                  builder: (BuildContext context) {
                    return DialogWidget.getDialog(context, "删除申请",
                        "点击确定键将删除该条申请！     编号：" + s1.ID.toString(), () {
                      ShipUse.Delete(s1);
                      callback();
                    });
                  },
                );
              }),
        ));
  }

  static Widget DocReviewCard(
      BuildContext context, DocReview s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat2(s1.CreateTM);
    var u1 = CacheHelper.GetUser(s1.UserID);
    bz = bz + "     " + u1.Name;
    bz = bz + "    " + s1.StateName;

    return Card(
        key: Key(s1.ID.toString()),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: Container(
          margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
          child: ListTile(
              title: Text(s1.Title),
              subtitle: Text(
                bz,
                style: TextStyle(
                    color: Colors.black38, fontSize: 14.0, height: 1.8),
              ),
              trailing: Container(
                width: 10.0,
                height: 10.0,
                child: new CircleAvatar(
                  backgroundColor:
                      s1.State >= s1.StateMax ? Colors.green : Colors.red,
                ),
              ),
              onTap: () {
                RouteHelper.getDocReviewInfoPage(context, s1, callback);
              },
              onLongPress: () {
                if (s1.State > 2) {
                  ChannelHelper.showToast("签发完成，不可删除！");
                  return;
                }

                if (!Helper.StrPB(s1.UserID, UIData.CurrentUser!.Guid)) {
                  ChannelHelper.showToast("只能本人进行删除！");
                  return;
                }

                showDialog(
                  context: context,
                  builder: (BuildContext context) {
                    return DialogWidget.getDialog(context, "删除申请",
                        "点击确定键将删除该条申请！     编号：" + s1.ID.toString(), () {
                      DocReview.Delete(s1);
                      callback();
                    });
                  },
                );
              }),
        ));
  }

  static Widget DocSendCard(
      BuildContext context, DocSend s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat2(s1.CreateTM);
    var u1 = CacheHelper.GetUser(s1.UserId);
    bz = bz + "     " + u1.Name;
    if (s1.State == 0) bz = bz + "     部门审核中";
    if (s1.State == 1) bz = bz + "     会签中";
    if (s1.State == 2) bz = bz + "     领导签发中";
    if (s1.State == 3) bz = bz + "     已签发";
    if (s1.State == 4) bz = bz + "     已完成";
    bz = bz + "     已完成";

    return Card(
        key: Key(s1.ID.toString()),
        margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
        shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        child: Container(
          margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
          child: ListTile(
              title: Text(s1.Title),
              subtitle: Text(
                bz,
                style: TextStyle(
                    color: Colors.black38, fontSize: 14.0, height: 1.8),
              ),
              trailing: Container(
                width: 10.0,
                height: 10.0,
                child: new CircleAvatar(
                  backgroundColor: s1.State >= 3 ? Colors.green : Colors.red,
                ),
              ),
              onTap: () {
                RouteHelper.getDocSendInfoPage(context, s1, callback);
              },
              onLongPress: () {
                if (s1.State > 2) {
                  ChannelHelper.showToast("签发完成，不可删除！");
                  return;
                }

                if (!Helper.StrPB(s1.UserId, UIData.CurrentUser!.Guid)) {
                  ChannelHelper.showToast("只能本人进行删除！");
                  return;
                }

                showDialog(
                  context: context,
                  builder: (BuildContext context) {
                    return DialogWidget.getDialog(context, "删除申请",
                        "点击确定键将删除该条申请！     编号：" + s1.ID.toString(), () {
                      DocSend.Delete(s1);
                      callback();
                    });
                  },
                );
              }),
        ));
  }

  static Widget CleanObjectsCard(
      BuildContext context, CleanObjects s1, RefrushCallback callback) {
    String bz = s1.CarCode;
    String bz2 = Helper.DateTimeFormat(s1.CreateTM) + "     ";

    bz = bz + "     " + s1.UName;

    if (s1.State == 0) bz2 = bz2 + "登记单已创建";
    if (s1.State == 1) bz2 = bz2 + "待司机确认";
    if (s1.State == 2) bz2 = bz2 + "运输中";
    if (s1.State == 3) bz2 = bz2 + "待审核";
    if (s1.State == 4) bz2 = bz2 + "已完成";

    return Card(
      key: Key(s1.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
          title: Text(bz),
          subtitle: Text(
            bz2,
            style:
                TextStyle(color: Colors.black38, fontSize: 14.0, height: 1.8),
          ),
          trailing: Container(
            width: 10.0,
            height: 10.0,
            child: new CircleAvatar(
              backgroundColor: s1.State >= 4 ? Colors.green : Colors.red,
            ),
          ),
          onTap: () {
            RouteHelper.getCleanInfoPage(context, s1, callback);
          },
          onLongPress: () {
            if (!UIData.IfLogin) return;
            if (s1.State > 2) {
              ChannelHelper.showToast("已审核，不可删除！");
              return;
            }
            showDialog(
              context: context,
              builder: (BuildContext context) {
                return DialogWidget.getDialog(
                    context, "删除申请", "点击确定键将删除该条申请！     编号：" + s1.ID.toString(),
                    () {
                  CleanObjects.Delete(s1);
                  callback();
                });
              },
            );
          }),
    );
  }

  static Widget InspectReportCard(
      BuildContext context, InspectReport record, VoidCallback refrush) {
    var u1 = CacheHelper.GetUser(record.UserId);

    return Card(
      key: Key(record.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
          leading: Icon(
            Icons.directions_bike,
            color: Colors.blue,
            size: 36.0,
          ),
          title: Text(record.Zone + "   " + record.InspectType),
          subtitle: Text(
            Helper.DateTimeFormat(record.CreateTM) + "   " + u1.Name,
          ),
          onTap: () =>
              RouteHelper.ShowPage(context, InspectReportInfoPage(record)),
          onLongPress: () =>
              DialogWidget.ShowDelete(context, record.InspectType, () async {
                record.State = -1;
                await InspectReport.Update(record);
                refrush();
              })),
    );
  }

  static Widget JXGZPCard(
      BuildContext context, JXGZP s1, RefrushCallback callback) {
    String bz = Helper.DateTimeFormat(s1.CreateTime);
    if (s1.State == 0) bz = bz + "     部门批复中";
    if (s1.State == 1) bz = bz + "     会签中";
    if (s1.State == 2) bz = bz + "     公司领导批复中";
    if (s1.State == 3) bz = bz + "     已签发，发布中";
    if (s1.State == 4) bz = bz + "     已发布，待执行";
    if (s1.State == 5) bz = bz + "     回执审核中";
    if (s1.State == 6) bz = bz + "     完成";

    return Card(
      key: Key(s1.ID.toString()),
      margin: const EdgeInsets.only(top: 0.2, bottom: 0.2),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: ListTile(
        //leading: ImageWidget.UpFileImage(s1.Name),
        title: Text(s1.Title),
        subtitle: Text(
          bz,
          style: TextStyle(color: Colors.black38, fontSize: 14.0, height: 1.8),
        ),
        trailing: Container(
          width: 10.0,
          height: 10.0,
          child: new CircleAvatar(
            backgroundColor: s1.State == 6 ? Colors.green : Colors.red,
            //radius: 2.0,
          ),
        ),
        //trailing: Text("马龙伟"),
        // leading: IconHelper.getFileIcon(s1., 36.0),
        onTap: () {
          RouteHelper.getJXGZPInfoPage(context, s1, callback);
        },
      ),
    );
  }

  static Widget StationCheckCard3(BuildContext context, Station station,
      StationCheck record, StationCheckDeleteCallback refrush) {
    var t1 = DateTime.parse(record.CreateTime);
    var u1 = CacheHelper.GetUser(record.UserId);
    String _remark = Helper.DateTimeFormat(record.CreateTime);
    if (u1 != null) _remark = _remark + "     " + u1.Name;
    return new Card(
      key: Key(record.ID.toString()),
      margin: const EdgeInsets.only(top: 5.0, bottom: 5.0),
      // margin: const EdgeInsets.all(6.0),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      color: GlobalConfig.cardBackgroundColor,
      child: new Container(
          // margin: EdgeInsets.all(4.0),
          // padding: EdgeInsets.all(4.0),
          child: ListTile(
        onTap: () {
          //
          if (record.UserId == UIData.CurrentUser!.Guid) {
            RouteHelper.StationCheckAdd(context, station, record, () => {});
          } else {
            RouteHelper.StationCheckInfo(context, station, record, () => {});
          }
        },
        onLongPress: () {
          showDialog(
            context: context,
            builder: (BuildContext context) {
              if (u1 != null && u1.Guid != record.UserId) {
                return DialogWidget.getAlert(context, "提示", "只能删除自己上传的记录");
              } else {
                return DialogWidget.getDialog(
                    context, "删除记录", "点击确定键将删除该条记录！     " + record.CreateTime,
                    () {
                  StationCheck.Delete(record);
                  refrush(record);
                });
              }
            },
          );
        },
        title: Text(Helper.DateTimeFormat(record.CreateTime)),
        trailing: Text(
          u1.Name,
        ),
        subtitle: Text(record.Works),
      )),
    );
  }

  static Widget inCard(Widget s1, {String? key}) {
    if (key == null) key = Helper.uuid.v1();
    return Card(
      key: Key(key),
      margin: const EdgeInsets.only(top: 6.0, bottom: 2.0),
      shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: s1,
    );
  }

  static Widget inCard2(Widget s1, {String? key}) {
    if (key == null) key = Helper.uuid.v1();
    return Container(
      key: Key(key),
      margin: const EdgeInsets.only(top: 6.0, bottom: 2.0),
      //shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
      child: s1,
    );
  }
}
